package com.taomus.mytools.simplec.common;

import java.util.Queue;
import java.util.concurrent.LinkedBlockingDeque;

public final class TempToken {
	private final static Queue<Token> q = new LinkedBlockingDeque<>();
	private static int num = 0;
	public static Token create(){
		Token temp = new Token(WordEnum.TEMP,"temp_"+ num ++ );
		temp.setLevel(1);
		q.offer(temp);
		return temp;
	}
	public static Token create(Token attr){
		Token temp = new Token(WordEnum.TEMP,"temp_"+ num ++ );
		temp.setLevel(1);
		q.offer(temp);
		return temp;
	}
	public static Token peek(){
		return q.peek();
	}
	public static Token poll(){
		num --;
		return q.poll();
	}
	public static boolean isEmpty(){
		return q.isEmpty();
	}
}
